<script>
	import config from './config'
	import store from '@/store'
	import {
		getToken
	} from '@/utils/auth'
	import AppUpdate from "./utils/AppUpdate.js"

	export default {
		onLaunch: function() {
			this.initApp();
			AppUpdate();
		},
		methods: {
			// inti app
			initApp() {
				// init app config
				this.initConfig()
				// check user login status
				//#ifdef H5
				this.checkLogin()
				//#endif
			},
			initConfig() {
				this.globalData.config = config
			},
			checkLogin() {
				if (this.$route.path == '/pages/register' || this.$route.path == '/pages/login') {
					return;
				}

				if (!getToken()) {
					this.$tab.reLaunch('/pages/login')
				}
			}
		}
	}
</script>

<style lang="scss">
	@import "uview-ui/index.scss";
	@import '@/static/scss/index.scss';

	//shipei pc
	@media only screen and (min-width:750px) {
		body {
			width: 550px;
			height: 100%;
			margin: auto;
		}

		.uni-tabbar {
			width: 550px;
			margin: auto;
		}

		.uni-page-head {
			width: 550px;
			margin: auto;
		}

	}
</style>